USE [ServerMonitor]
GO
IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_SQLPerformanceCount_LogTime]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[SQLPerformanceCount] DROP CONSTRAINT [DF_SQLPerformanceCount_LogTime]
END
GO
USE [ServerMonitor]
GO
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SQLPerformanceCount]') AND type in (N'U'))
DROP TABLE [dbo].[SQLPerformanceCount]
GO
USE [ServerMonitor]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SQLPerformanceCount](
	[LogTime] [datetime] NOT NULL,
	[ConnectCount] [bigint] NULL,
	[LoginPerSec] [bigint] NULL,
	[LogoutPerSec] [bigint] NULL,
	[RequestsPerSec] [bigint] NULL,
	[CompilationsPerSec] [bigint] NULL,
	[ReCompilationsPerSec] [bigint] NULL,
	[BufferHitRatio] [bigint] NULL,
	[PageLife] [bigint] NULL,
	[TagetMemoryKB] [bigint] NULL,
	[TotalMemoryKB] [bigint] NULL,
	[LockRequestsPerSec] [bigint] NULL,
	[LockTimeoutsPerSec] [bigint] NULL,
	[Deadlocks] [bigint] NULL,
	[locksWaitsPerSec] [bigint] NULL,
	[locksWaitsTime] [bigint] NULL,
	[LockAverageWaitsTime] [bigint] NULL,
	[DataFileSizeKB] [bigint] NULL,
	[LogFileSizeKB] [bigint] NULL,
	[LogFileUsedSizeKB] [bigint] NULL,
	[LogPercent] [bigint] NULL,
	[ActiveTran] [bigint] NULL,
	[TranPerSec] [bigint] NULL,
	[ReplPendingXacts] [bigint] NULL,
	[ReplTransRate] [bigint] NULL,
	[LogCacheReadPerSec] [bigint] NULL,
	[LogCacheHitRatio] [bigint] NULL,
	[BulkCopyRowsPerSec] [bigint] NULL,
	[BulkCopuThroughputPerSec] [bigint] NULL,
	[BackupRestoreThroughtPerSec] [bigint] NULL,
	[DBCCLogicalScanBytesPerSec] [bigint] NULL,
	[ShrinkDataMoveBytePerSec] [bigint] NULL,
	[LogFlushesPerSec] [bigint] NULL,
	[LogBytesFlushedPerSec] [bigint] NULL,
	[LogFlushWaitsPerSec] [bigint] NULL,
	[LogFlushWaitTime] [bigint] NULL,
	[LogTruncations] [bigint] NULL,
	[LogGrowths] [bigint] NULL,
	[LogShrinks] [bigint] NULL,
 CONSTRAINT [PK_SQLPerformanceCount] PRIMARY KEY CLUSTERED 
(
	[LogTime] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[SQLPerformanceCount] ADD  CONSTRAINT [DF_SQLPerformanceCount_LogTime]  DEFAULT (getdate()) FOR [LogTime]
GO


